Adjusting alarms based on sleep onset latency

ABSTRACT

In some implementations, a mobile device can adjust an alarm setting based on the sleep onset latency duration detected for a user of the mobile device. For example, sleep onset latency can be the amount of time it takes for the user to fall asleep after the user attempts to go to sleep (e.g., goes to bed). The mobile device can determine when the user intends or attempts to go to sleep based on detected sleep ritual activities. Sleep ritual activities can include those activities a user performs in preparation for sleep. The mobile device can determine when the user is asleep based on detected sleep signals (e.g., biometric data, sounds, etc.). In some implementations, the mobile device can determine recurring patterns of long or short sleep onset latency and present suggestions that might help the user sleep better or feel more rested.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No.15/590,805, filed May 9, 2017, which is a continuation of U.S. patentapplication Ser. No. 14/871,882, filed Sep. 30, 2015, entitled“Adjusting Alarms Based on Sleep Onset Latency,” the content of which isincorporated herein by reference in its entirety.

TECHNICAL FIELD

The disclosure generally relates to human sleep detection.

BACKGROUND

Most people require a certain amount of sleep at night to feel wellrested the following day. Often, when a person works, the person willset an alarm to wake them up at an appropriate time so that they canarrive at work on time. To get sufficient sleep, the person will go tobed at a time that allows for an appropriate amount of sleep (e.g., 7hours, 8 hours, etc.). However, most people do not fall asleep rightaway when they go to bed. So, even if the person goes to bed at anappropriate time to provide 8 hours of sleep, the person often only endsup with 6 or 7 hours of sleep when the alarm goes off in the morning.

SUMMARY

In some implementations, a mobile device can adjust an alarm settingbased on the sleep onset latency duration detected for a user of themobile device. For example, sleep onset latency can be the amount oftime it takes for the user to fall asleep after the user attempts to goto sleep (e.g., goes to bed). The mobile device can determine when theuser intends or attempts to go to sleep based on detected sleep ritualactivities. Sleep ritual activities can include those activities a userperforms in preparation for sleep. The mobile device can determine whenthe user is asleep based on detected sleep signals (e.g., biometricdata, sounds, etc.). In some implementations, the mobile device candetermine recurring patterns of long or short sleep onset latency andpresent suggestions that might help the user sleep better or feel morerested.

Particular implementations provide at least the following advantages:the mobile device can help the user feel more rested by automaticallyadjusting an alarm or suggesting an earlier bedtime based on thedetermined sleep onset latency to ensure that the user gets enoughsleep; the mobile device can automatically determine sleep onset latencyusing various sensors of the mobile device; the mobile device canautomatically identify sleep patterns that may be adversely affectingthe user.

Details of one or more implementations are set forth in the accompanyingdrawings and the description below. Other features, aspects, andpotential advantages will be apparent from the description and drawings,and. from the claims.

DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram of an example computing device for adjustingalarms based on sleep onset latency.

FIG. 2 illustrates an example graphical user interface for specifying asleep goal.

FIG. 3 illustrates an example graphical user interface of a calendarapplication.

FIG. 4 illustrates an example graphical user interface for determining asleep onset latency duration based on pressure applied by a user to adisplay of a computing device.

FIG. 5 illustrates an example graphical user interface for suggesting anearlier bedtime to the user.

FIG. 6 illustrates an example graphical user interface for presenting asleep summary indicating a pattern of long sleep onset latencydurations.

FIG. 7 illustrates an example graphical user interface for presenting asleep summary indicating a pattern of short sleep onset latencydurations.

FIG. 8 is flow diagram of an example process for determining sleep onsetlatency.

FIG. 9 is a flow diagram of an example process for adjusting alarmsbased on sleep onset latency.

FIG. 10 is a flow diagram of an example process for identifying apattern of abnormal sleep onset latency.

FIG. 11 is a block diagram of an example computing device that canimplement the features and processes of FIGS. 1-10.

Like reference symbols in the various drawings indicate like elements.

DETAILED DESCRIPTION Overview

FIG. 1 is a block diagram of an example computing device 100 foradjusting alarms based on sleep onset latency. For example, computingdevice 100 can be a mobile device, such as a smartphone, tabletcomputer, laptop computer, etc. Computing device 100 can be a wearabledevice, such as a smart watch, smart eye glasses, smart contacts, etc.,for example.

In some implementations, computing device 100 can include sleep logic102. For example, sleep logic 102 can be an operating system softwareprocess (e.g., function, utility, daemon, etc.). Sleep logic 102 can bean independent software process (e.g., a standalone application). Sleeplogic 102 can interact with various sensors of computing device 100 todetect sleep signals (e.g., user activities, biometric data, etc.)indicating when the user intends to sleep, when the user actually fallsasleep, and when the user wakes up. Sleep logic 102 can use the sleepsignals to adjust alarms (e.g., alarm clock. alarms, nap alarms, etc.)on computing device 100 so that the user can get enough sleep and feelrested. For example, sleep logic 102 can use the signals to determinehow long it takes for the user to fall asleep (e.g., sleep onsetlatency) and adjust an alarm (e.g., morning wake up alarm) to allow theuser to get sufficient sleep to feel rested.

Detecting Sleep

In some implementations, computing device 100 can detect when the userfalls asleep. In some implementations, sleep logic 102 can detect whenthe user falls asleep based on user input. For example, when the user isusing computing device 100 (e.g., using an application, providing userinput, etc.), the user is performing a conscious human activity andcannot possibly be sleeping. When the user stops using computing device100 for a period of time (e.g., 5 hours, 7 hours, etc.), then sleeplogic 102 can determine that the user is asleep. Thus, if, for example,the display of computing device 100 is dark (e.g., not illuminated) fora period of time (e.g., at least 7 hours, at least 5 hours, etc.), sleeplogic 102 can determine that the user was sleeping during the period oftime. Sleep logic 102 can determine the sleep start time based on thetime when the sleep period began. For example, if the last user inputbefore the sleep period was at 10:36 pm, then sleep logic 102 candetermine that the sleep period began at 10:36 pm. If the screen wentdark at 11:16 pm and stayed dark for 7.5 hours, then sleep logic 102 candetermine that the sleep period began at 11:16 pm, for example.

In some implementations, sleep logic 102 can detect when the user fallsasleep based on sensor data. For example, computing device 100 caninclude various sensors that can detect environmental and/or biometricsignals that can be used to determine when the user is sleeping. Sleeplogic 102 can detect sleep based on a single signal (e.g., heartrate) ora combination of signals (e.g., heartrate, breathing, movement, etc.).For example, sleep logic 102 can use multiple signals to improve theprobability that the sleep determination is correct. When the detectedsignals correspond to sleep (as described below), sleep logic 102 candetermine that the user is asleep. For example, when the detectedsignals correspond to sleep for a period of time (e.g., at least 5hours, at least 6 hours, etc.), then sleep logic 102 can determine thatthe user is asleep. If a detected signal corresponds to the user beingawake (e.g., conscious, active, etc.), then sleep logic 102 candetermine that the user is awake, as described further below.

In some implementations, computing device 100 can include sound sensor104 (e.g., a microphone) that can detect sounds near computing device100. In some implementations, sound sensor 104 can detect sleep sounds.For example, sleep logic 102 can initially determine that the user issleeping based on the absence of user input, as described above. Soundsensor 104 can collect sleep sounds while the user is sleeping. (e.g.,snoring, slow breathing, bed sounds generated when the user moves in thebed, etc.). Sleep logic 102 can store the collected sleep sounds insound database 106. When sleep logic 102 later detects similar sleepsounds, sleep logic 102 can analyze the sleep sounds and determine thatthe sleep sounds correspond to the user sleeping by comparing thedetected sleep sounds to the sleep sounds in sound database 132.

In some implementations, computing device 100 can include movementsensor 106. For example, movement sensor 106 can be an accelerometer.Movement sensor 106 can detect when computing device 100 is moving, forexample. When the user of computing device 100 is holding or wearingcomputing device 100 and the user moves, movement sensor 106 can detectthe movement and sleep logic 102 can determine that the user is awake.When movement sensor 106 detects very little movement (e.g., below athreshold frequency, or threshold magnitude), then sleep logic 102 candetermine that the user is asleep.

In some implementations computing device 100 can include heart ratesensor 108. For example, heart rate sensor 108 can be a motion sensor.For example, the motion sensor can be worn near the heart or on thewrist to detect motion corresponding to the user's pulse. Heart ratesensor 108 can be a microphone. For example, the microphone can be wornon the wrist near the radial artery to detect sounds corresponding tothe user's pulse. Heart rate sensor 108 can be a photoplethysmogram(PPG) sensor, such as a pulse oximeter camera, or other optical sensor.Heart rate sensor 108 can optically obtain a plethysmogram byilluminating the skin and measuring changes in light absorption todetect the user's pulse. Sleep logic 102 can use the pulse datagenerated by heart rate sensor 108 to determine a heart rate for theuser. Sleep logic 102 can use the pulse data generated by heart ratesensor 108 to determine the variability in the user's pulse. Forexample, pulse or heart rate variability decreases as the usertransitions from a wake state to a sleep state. Sleep logic 102 candetermine that the user is sleeping when the user's heart rate and/orheart rate variability is below respective threshold values. Sleep logic102 can determine that the user is awake when the user's heart rateand/or heart rate variability are above respective threshold values.

in some implementations, computing device 100 can include breathing ratesensor 110. For example, breathing rate sensor 108 can be a microphone.For example, the microphone can detect sounds corresponding to breathstaken by the user. Breathing rate sensor 108 can be a photoplethysmogram(PPG) sensor such as a pulse oximeter, camera, or other optical sensor.Breathing rate sensor 108 can optically obtain a plethysmogram byilluminating the skin and measuring changes in light absorption todetect when the user takes a breath. Sleep logic 102 can use thebreathing rate data generated by breathing rate sensor 108 to determinea breathing rate (e.g., frequency of breaths), breathing ratevariability, and/or breathing amplitude (e.g., how big or deep thebreaths are for the user. Sleep logic 102 can determine that the user issleeping when the user's breathing rate, breathing rate variability,and/or breathing amplitude are below respective threshold values. Sleeplogic 102 can determine that the user is awake when the user's breathingrate, breathing rate variability, and/or breathing amplitude are aboverespective threshold values. For example, slow, regular breaths canindicate that the user is sleeping while faster, inconsistent breathingcan indicate that the user is awake.

In some implementations, computing device 100 can include light sensor112. For example, light sensor 112 can be a photoresistor that detectsthe light intensity of the environment around computing device 100.Sleep logic 102 can use the light intensity data generated by lightsensor 112 to determine whether the user is sleeping. For example,humans usually enjoy sleeping in a dark environment. Thus, when lightsensor 112 detects that the light intensity is above a thresholdintensity value, sleep logic 102 can determine that the user is awake.When light sensor 112 detects that the light intensity is below thethreshold value, sleep logic 102 can determine that the user issleeping.

In some implementations, computing device 100 can include pressuresensor 114. For example, pressure sensor 114 can be incorporated into orbehind a touch sensitive display of computing device 100. A user cantouch and apply pressure to the touch sensitive display and pressuresensor 114 can determine the amount of pressure being applied to thetouch sensitive display. To determine the start of sleep, the user canbe prompted to apply and hold pressure to the touch sensitive display.When the user falls asleep, the user will not be able to continueapplying pressure to the display. Sleep logic 102 can receive pressuredata from pressure sensor 114, determine the amount of pressure beingapplied to the display by the user has decreased (e.g., below somepressure value), and determine that the user is asleep based on thedecrease in pressure.

In sonic implementations, computing device 100 can include touch sensor116. For example, touch sensor 116 can be a touch sensitive display, abutton, or some other device that is responsive to the user's touch.Sleep logic 102 can use the touch sensor data generated by touch sensor116 to determine if the user is awake or asleep. For example, when touchsensor 116 detects that the user has touched computing device 100 (e.g.,the touch sensitive display, button, etc.), then sleep logic 102 candetermine that the user is awake. When touch sensor 116 does not detectthe user touching computing device 100 for a period of time (e.g., 4hours, 6 hours, etc.), then sleep logic 102 can determine that the useris asleep.

In some implementations, computing device 100 can include other sensors118. For example, other sensors 118 can include a temperature sensor, alocation sensor, or any other sensor that can generate data that can beused to inform the sleep determination. For example, the temperaturesensor can detect the heat of the user's skin. Typically, skintemperature (e.g., surface temperature) of the human body increaseswhile sleeping. Thus, sleep logic 102 can determine that the user issleeping when the skin temperature data generated by the temperaturesensor indicates an increase in the user's body temperature above athreshold temperature. When other sensors 118 is a location sensor, forexample, sleep logic 102 can determine that the user is sleeping whenthe location of computing device 100 is the user's home or at some otherplace where the user typically sleeps. For example, sleep logic 102 maydetermine that the user is still awake when the location of computingdevice 100 is the user's place of business.

In some implementations, sleep logic 102 can determine when the user isawake using the sensors described above. For example, the varioussensors can detect conscious human activity and sleep logic 102 candetermine that the user is awake based on the detected activity. Forexample, sleep logic 102 can receive sensor data that indicatesconscious movement, talking, increased heart rate, increased breathingrate, increased lighting, and/or use of computing device 102 (e.g.,touch input) and determine that the user is awake based on the sensordata. Sleep logic 102 can determine the wake time based on when thefirst sensor detected conscious human activity. For example, the waketime can correspond to the time when a sensor first detected consciousmovement, talking; increased heart rate, increased breathing rate,increased lighting, and/or use of computing device 102 (e.g., touchinput).

In some implementations, the sleep start time and sleep end time (waketime) can be used to determine the sleep period. For example, if thesleep start time is 11 pm and the sleep end time is 6 am, then the sleepperiod (duration) is 7 hours (e.g., 6 am-11 pm=7 hours). In someimplementations, sleep logic 102 can store sleep the sleep start time,sleep end time, and/or sleep duration in sleep history database 134. Forexample, each record in sleep history database 134 can include sleepdata for an instance of sleep. The sleep data can include sleep starttime, sleep end time, sleep period duration, and sensor data collectedwhile the user is sleeping, as described above. The sensor data can beused to confirm sleep state when determining whether the user issleeping by comparing the stored sensor data representing the user'ssleep state to current sensor data representing the user's currentunknown state.

In some implementations, sleep logic 102 can predict future sleepperiods. For example, sleep logic 102 can analyze the sleep history datain sleep history database 134 to determine when the user usually sleeps.For example, if the user typically (e.g., historically has a pattern)sleeps between 11 pm. and 7 am, then sleep logic 102 can predict thatthe user will go to sleep at 11 pm on the current day and/or futuredays.

Determining the Sleep Ritual

In some implementations, sleep logic 102 can determine the user's sleepritual. For example, humans are creatures of habit. Most people have aspecific set of activities that they perform before going to bed everynight. For example, a user of computing device 100 may take the dog out,lock the front door, shut the window blinds, exercise, take a shower,and/or brush her teeth. These activities may not be done in the exactsame order every night. The user may not perform every one of theseactivities every night. However, each night the user will perform atleast some (e.g., a subset) of these activities as part of the user'ssleep ritual before she goes to bed. For example, if a user performs aparticular activity at least a threshold number of nights (e.g., 5, 6,at least 50%. etc.) per week, then sleep logic 120 can determine thatthe particular activity is a sleep ritual activity. These sleep ritualactivities can be used to infer the user's intent to go to sleep.

In some implementations, sleep logic 102 can monitor sensor data beforethe user goes to sleep to determine the user's sleep ritual. Forexample, after sleep logic 102 determines the user's sleep patterns, asdescribed above, sleep logic 102 can monitor the environment ofcomputing device 100 to determine the user's activities right before theuser is predicted to go to sleep. If sleep logic 102, for example,predicts that the user will go to sleep at 10 pm, for example, sleeplogic 102 can turn on the sensors of computing device 100 before theuser is predicted to go to sleep (e.g., 5 hour before, 1 hour before,9:30 pm, etc.) to monitor or detect the user's bedtime activities (e.g.,sleep ritual).

In some implementations, sleep logic 120 can monitor the environment ofcomputing device 102 to determine the user's activities all the time oron regular intervals (e.g., every 2 minutes, every 5 minutes, etc.)throughout the day to detect and identify the user's activities. Whensleep logic 120 determines that the user has gone to sleep, sleep logic120 can analyze the user's activities to determine which activities wereperformed in a time period (e.g., 30 minutes, 1 hour, etc.) before theuser went to sleep.

In some implementations, sleep logic 102 can identify sleep ritualactivities using sound data generated by sound sensor 104. For example,various activities performed by the user as the user is preparing to goto sleep may generate noise or sounds that are detectable by soundsensor 104 and/or identifiable by sleep logic 102. Sleep logic 102, forexample, can obtain sound samples (e.g., sound fingerprints) from anetwork resource (not shown) that have been mapped to correspondinghuman activities that are known to have generated the sampled sounds.The sound samples can include the sound of someone brushing their teeth,adjusting window blinds, opening and closing doors, taking a shower, orany other activity that generates an identifiable or unique sound. Themapping of sounds to activities can be stored in sound database 132, forexample. Thus, when the user brushes her teeth, the sound of thebrushing can be detected by sound sensor 104 (e.g., microphone), and canbe compared to the sounds in sound database 132 by sleep logic 102 todetermine that the detected sound corresponds to the user brushing herteeth. After sleep logic 102 identifies the sound of the user brushingher teeth, the user's tooth brushing activity can be added to the user'ssleep ritual activities stored in sleep ritual database 130, forexample. Similarly, sound sensor 104 can detect and sleep logic 102 canidentify sounds related to exercising, showering, closing window blinds,opening and closing doors, taking a dog outside, filling a glass withwater, using the toilet, and/or any other sleep ritual activity. After asleep ritual activity has been identified, sleep logic 102 can add thesleep ritual activity to sleep ritual database 130.

In some implementations, sleep logic 102 can identify sleep ritualactivities using movement data generated by movement sensor 106. Forexample, various activities performed by the user as the user ispreparing to go to sleep may generate motion or vibrations that aredetectable by movement sensor 106 and/or identifiable by sleep logic102. Sleep logic 102 can, for example, obtain motion samples (e.g.,motion fingerprints, patterns of motion) from a network resource (notshown) that have been mapped to corresponding activities that are knownto have generated the sampled motion. The motion samples can include themotion of someone brushing their teeth (e.g., when. wearing a smartwatch), walking or exercising, or any other activity that generatesmotion or movement. The mapping of motion to activities can be stored inmotion database 136, for example. Thus, when the user exercises beforebed, the motion of the exercise can be detected by movement sensor 106(e.g., accelerometer), and can be compared to the motion samples inmotion database 136 by sleep logic 102 to determine that the detectedmotion corresponds to the user exercising. After sleep logic 102identifies the motion of the user exercising, the user's exerciseactivity can be added to the user's sleep ritual activities stored insleep ritual database 130. Similarly, movement sensor 106 can detect andsleep logic 102 can identify motion related to tooth brushing, and/orany other sleep ritual activity. After a sleep ritual activity has beenidentified, sleep logic 102 can add the sleep ritual activity to sleepritual database 130.

In some implementations, sleep logic 102 can identify sleep ritualactivities using light intensity data generated by light sensor 112. Forexample, humans normally like to sleep in a dark room. Thus, darkeningthe user's environment by drawing window shades or turning off a lightcan be part of the user's sleep ritual. When the user darkens the roombefore the predicted bedtime, light sensor 112 can detect the change inambient light intensity and generate ambient light intensity datareflecting the change. Sleep logic 102 can analyze the light intensitydata, determine that the ambient light intensity has been lowered, anddetermine that the user has darkened the room. Sleep logic 102 can storethe darken room activity is sleep ritual database 130 as an activitythat is part of the user's sleep ritual.

In some implementations, sleep logic 102 can identify sleep ritualactivities based on application usage. For example, the user may have ahabit of using specific software applications installed on computingdevice 100 immediately before going to bed. The user can check calendarapplication 140. The user can set a wake up alarm using alarm clockapplication 142. The user can use social media applications, newsapplications, a game application, an e-book reader application, and/orother applications before going to sleep. Sleep logic 102 can monitorapplication usage before the predicted sleep time (e.g., 1 hour before,0.5 hour before, etc.) and determine which applications the user usesbefore the user's predicted sleep time. Sleep logic 102 can store thedetected application use activities as sleep ritual activities in sleepritual database 130.

Determining Intent to Sleep

In some implementations, sleep logic 102 can determine the start ofsleep onset latency by determining that the user intends to sleep at aparticular time. For example, a user's sleep onset latency is the periodor duration of time that elapses starting when the user intends to go tosleep and ending when the user actually falls asleep.

In some implementations, the user's intent to sleep can be determinedbased on detecting the user has performed the user's sleep ritual. Forexample, sleep logic 102 can monitor the activities of the user beforethe user's predicted sleep period using the sensors of computing device100, as described above. Sleep logic 102 can identify the user'sactivities based on the sensor data, as described above, and compare theactivities to the activities stored in sleep ritual database 130 todetermine if the detected activity is part of the user's sleep ritual.Sleep logic 102 can determine that the user's sleep ritual was performedby the user when sleep logic 102 determines that a threshold number ofthe sleep ritual activities identified in sleep database 130 wereperformed. For example, sleep logic 102 can determine that the user isperforming the user's sleep ritual when a minimum number (e.g., three ormore) of the sleep ritual activities were performed in a short period oftime (e.g., within 15 minutes, within 30 minutes, etc.). Sleep logic candetermine that the user is performing the user's sleep ritual when aportion (e.g., greater than 30%, greater than 50%, etc.) of the sleepritual activities were performed by the user in a short period of time.

In some implementations, sleep logic 102 can determine the start of theuser's sleep onset latency based on the time when the last of the user'ssleep ritual activities is performed. If the user's sleep ritual (asindicated by the activities in sleep ritual database 130) includes theactivities shower, brush teeth, darken the room, and set the wake upalarm for the next day, then, when the last of these activities isdetected by the sensors of computing device 100, sleep logic 102 candetermine that the user intends to sleep. For example, if darkening theroom is the last of the sleep ritual activities performed by the userand detected by light sensor 112 of computing device 100, then sleeplogic 102 can determine the start of the user's sleep onset latency tobe the time at which darkening the room was detected. If setting thealarm (e.g., using an alarm clock application) is the last of the sleepritual activities detected by computing device 100, then sleep logic 102can determine the start of the user's sleep onset latency to be the timeat which the user set the alarm.

In some implementations, sleep logic 102 can determine the start of theuser's sleep onset latency based on heart rate data generated by heartrate sensor 108. For example, the user's heart rate may decrease insteps: first as a user prepares to sleep and again when the user isactually asleep. Thus, sleep logic 102 can include two heart ratethresholds: a first heart rate threshold for determining intent to sleepor the start of sleep onset latency, and a second heart rate thresholdlower than the first heart rate threshold for determining when the useris sleeping. Heart rate sensor 108 can detect the user's heart rate, asdescribed above, and send the heart rate data to sleep logic 102. Sleeplogic 102 can compare the user's heart rate to the first and secondheart rate thresholds. For example, if the user's heart rate is belowthe first heart rate threshold and above the second heart ratethreshold, the user is preparing to sleep and has begun the sleep onsetlatency period. If the user's heart rate is below the second heart ratethreshold, the user is sleeping. Thus, sleep logic 102 can determine thestart of sleep onset latency when the user's heartrate drops below thefirst heart rate threshold. Sleep logic 102 can determine the end ofsleep onset latency and the beginning of sleep when the user's heartratedrops below the second heart rate threshold.

Similarly, the user's heart rate variability may decrease in steps:first when the user is awake and resting, second when the user intendsto sleep, and third when the user is asleep. Thus, sleep logic 102 caninclude two heart rate variability thresholds for determining sleeponset latency: a first variability threshold for determining intent tosleep or the start of sleep onset latency, and a second variabilitythreshold lower than the first variability threshold for determiningwhen the user is sleeping. Heart rate sensor 108 can detect the user'sheart rate, as described above, and send the heart rate data to sleeplogic 102. Sleep logic 102 can compare the user's heart rate variabilityto the first and second variability thresholds. For example, if theuser's heart rate variability is below the first variability thresholdand above the second variability threshold, the user is preparing tosleep and has begun the sleep onset latency period. If the user's heartrate variability is below the second variability threshold, the user issleeping. Thus, sleep logic 102 can determine the start of sleep onsetlatency when the user's heart rate. variability drops below the firstheart rate threshold. Sleep logic 102 can determine the end of sleeponset latency and the beginning of sleep when the user's heart ratevariability drops below the second variability threshold.

In some implementations, sleep logic 102 can determine the start of theuser's sleep onset latency based on breathing rate data generated bybreathing rate sensor 110. For example, the user's breathing rate maydecrease in steps: first as a user prepares to sleep and again when theuser is actually asleep. Thus, sleep logic 102 can include two breathingrate thresholds: a first breathing rate threshold for determining intentto sleep or the start of sleep onset latency, and. a second breathingrate threshold lower than the first breathing rate threshold fordetermining when the user is sleeping. Breathing rate sensor 108 candetect the user's breathing rate, as described above, and send thebreathing rate data to sleep logic 102. Sleep logic 102 can compare theuser's breathing rate to the first and second breathing rate thresholds.For example, if the user's breathing rate is below the first breathingrate threshold and above the second breathing rate threshold, the useris preparing to sleep and has begun the sleep onset latency period. Ifthe user's breathing rate is below the second breathing rate threshold,the user is sleeping. Thus, sleep logic 102 can determine the start ofsleep onset latency when the user's breathing drops below the firstbreathing rate threshold. Sleep logic 102 can determine the end of sleeponset latency and the beginning of sleep when the user's breathing dropsbelow the second breathing rate threshold.

Similarly, the user's breathing rate variability may decrease in steps:first as a user prepares to sleep and again when the user is actuallyasleep. Thus, sleep logic 102 can include two breathing variabilitythresholds: a first variability threshold for determining intent tosleep or the start of sleep onset latency, and a second variabilitythreshold lower than the first variability threshold for determiningwhen the user is sleeping. Breathing rate sensor 108 can detect theuser's breathing rate, as described above, and send the breathing ratedata to sleep logic 102. Sleep logic 102 can compare the user'sbreathing rate variability to the first and second variabilitythresholds. For example, if the user's breathing rate variability isbelow the first variability threshold and above the second variabilitythreshold, the user is preparing to sleep and has begun the sleep onsetlatency period. If the user's breathing rate variability is below thesecond variability threshold, the user is sleeping. Thus, sleep logic102 can determine the start of sleep onset latency when the user'sbreathing rate variability drops below the first variability threshold.Sleep logic 102 can determine the end of sleep onset latency and thebeginning of sleep when the user's breathing rate variability dropsbelow the second variability threshold. Similar thresholding logic canbe used to determine sleep onset latency based on breathing amplitude,as described above.

In some implementations, sleep logic 102 can determine the start of theuser's sleep onset latency based on user input detected by pressuresensor 114. For example, sleep logic 102 can use pressure sensor 114 todetermine when the user intends to sleep and the start of sleep. Sleeplogic 102 (or sleep application 146) can present a graphical userinterface on a touch sensitive display of computing device 100. Thegraphical user interface can ask the user to apply and hold pressure onthe display when the user intends to sleep. The pressure applied by theuser can be detected by pressure sensor 114. Pressure sensor 110 candetect a high level of pressure initially. The amount of pressuredetected by pressure sensor 110 will be reduced as the user falls asleepuntil little or no pressure is detected when the user is asleep. Thepressure data generated by pressure sensor 114 can be analyzed by sleeplogic 102 to determine when the user initially applied pressure (e.g.,corresponding to the users intent to sleep) and when the user appliedthe least amount of pressure after the initial pressure was applied(e.g., corresponding to when the user fell asleep) to determine thestart and end of the sleep onset latency period.

In some implementations, sleep logic 102 can determine the start of theuser's sleep onset latency based on user input detected by touch sensor116. For example, sleep logic 102 and/or sleep application 146 canprovide a graphical user interface that allows the user to indicate thatthe user intends to go to sleep. The user can, for example, touch abutton or graphical user interface element on a touch sensitive displayto indicate the user's intent to go to sleep. Touch sensor 116 candetect the touch input and sleep logic 102 can determine the start ofthe sleep onset latency period based on when the touch input wasreceived.

In some implementations, sleep logic 102 can determine the sleep onsetlatency duration based on the sleep onset latency start time and thesleep onset latency end time (e.g., sleep start time). For example,sleep onset latency can be the duration of time that passes between whenthe user intends to sleep and when the user actually falls asleep. Thebeginning of sleep onset latency can be determined based on sleep ritualinformation, biometric data (e.g., breathing rate, heart rate, etc.),and/or user input, as described above. The end of sleep onset latencyand the beginning of sleep can be determined based on biometric signals(e.g., breathing rate, heart rate, breathing sounds, movement, etc.) asdescribed above. Upon detecting that the user has fallen asleep, sleeplogic 102 can determine the duration of the sleep onset latency based onthe amount of time between the sleep onset latency start time and thesleep onset latency end time. The sleep onset latency duration can bestored in sleep history database 134, described above. For example, thedetermined sleep onset latency duration can he included in a sleeprecord corresponding to the current sleep instance in sleep historydatabase 134.

Using Sleep Onset Latency to Min & Alarms

In some implementations, sleep logic 102 can use the determined sleeponset latency to adjust alarm clock settings on computing device 102.For example, upon determining the sleep onset latency duration, sleeplogic 102 can obtain alarm clock settings information from alarm clockapplication 142. The alarm clock settings information can, for example,describe a time the following morning when the alarm clock will generatea sound to wake the user from sleeping. Sleep logic 102 can adjust thealarm clock settings based on the sleep onset latency duration to changethe time when the alarm will sound to allow the user more time to sleep.For example, if the wake alarm is set for 7 am and. the user's sleeponset latency duration is 45 minutes, sleep logic 102 can use anapplication programming interface (AK) of alarm clock application 142 toadjust the wake alarm so that the alarm sounds and wakes the user at7:45 am. For example, sleep logic 102 can adjust the wake alarm time byadding the sleep latency duration of 45 minutes to the scheduled alarmtime of 7 am.

In some implementations, sleep logic 102 can determine whether to adjustthe alarm clock settings based on calendar data. For example, whenadjusting an alarm time in alarm clock application 142, sleep logic 102can determine whether adjusting the alarm time will conflict with acalendar event scheduled in calendar application 140. Sleep logic 102can obtain the calendar event information from calendar application 140,for example, and determine if the calendar event information indicatesthat there is a calendar event scheduled that should prevent adjustingthe alarm lime. Continuing the example above, if the calendar event dataindicates that the user has scheduled a meeting at 7:30 am then sleeplogic 102 will not change the alarm time to 7:45 am because changing thealarm time would cause the user to miss the 7:30 meeting. However, ifthe calendar event data indicates that the user has a meeting scheduledfor 9:00 am, sleep logic 102 can change the alarm time to 7:45 becausethe user will still be able to make the scheduled meeting.

In some implementations, sleep logic 102 can determine whether to adjustthe alarm clock settings based on an estimated travel time to a meetingscheduled in calendar application 140. For example, when determiningwhether to adjust an alarm time in alarm clock application 142, sleeplogic 102 can determine whether the new alarm time generated based onthe sleep onset latency duration will allow enough time for the user totravel to a location associated with a calendar event scheduled incalendar application 140. Sleep logic 102 can obtain the calendar eventinformation from calendar application 140, for example, and determine ifthe calendar event information indicates that there is a calendar eventscheduled after the new alarm time. Sleep logic 102 can determine thelocation of the scheduled calendar event (e.g., location of a meeting)and estimate the travel time from the user's sleep location to thecalendar event location. If the amount of time between the new alarmtime and the calendar event time does not allow for enough time totravel to the meeting location, sleep logic 1.02 will not change thescheduled alarm time to the new alarm time. Continuing the exampleabove, if the calendar event data indicates that the user has scheduleda meeting at 8:30 am and the travel time between the user's sleeplocation (e.g., the user's home) is 1 hour, then sleep logic 102 willnot change the alarm time to 7:45 am because changing the alarm timewould cause the user to miss the 8:30 meeting (e.g., the user wouldarrive at the meeting at 8:45 am). However, if the calendar event dataindicates that the user has a meeting scheduled for 9:00 am, sleep logic102 can change the alarm time to 7:45 because the user will still beable to make the scheduled meeting (e.g., the user has enough time totravel 1 hour to the meeting).

In some implementations, sleep logic 102 can determine whether to adjustthe alarm clock settings based on a morning ritual duration. Forexample, when determining whether to adjust a scheduled alarm time inalarm clock application 142, sleep logic 102 can determine whether thenew alarm time generated based on the user's sleep onset latency willallow enough time for the user to perform the user's morning ritual andstill attend the calendar event scheduled in calendar application 140.For example, the user's morning ritual includes activities that the userperforms when the user wakes up in the morning to get ready to leave theuser's house (e.g., get ready for work). The user's morning ritual canbe determined similarly to the user's bedtime ritual (e.g., by usingsensor data to identify morning activities after the user wakes). Sleeplogic 102 can estimate the duration of the morning ritual based on astart time corresponding to when the user wakes (e.g., as detected bythe user's use of computing device 100) and an end time corresponding tothe last morning ritual activity performed. For example, sleep logic 102can determine the duration of the morning ritual by determining thestart time based on the user's use of computing device 100 and the endtime based on when the user leaves the sleep location (e.g., the user'shouse). Sleep logic 102 can determine that the user has left thesleeping location based on location data (e.g., satellite location data,cellular location data, Wi-Fi location data, etc.) generated or obtainedby computing device 100, for example. Sleep logic 102 can calculate theduration of the morning ritual by calculating the amount of time betweenthe start time and the end time of the morning ritual.

Sleep logic 102 can obtain the calendar event information from calendarapplication 140, for example, and determine if the calendar eventinformation indicates that there is a calendar event scheduled after thenew alarm time. If the amount of time between the new alarm time and thecalendar event time does not allow for enough time for the user toperform the user's morning ritual, sleep logic 102 will not change thescheduled alarm time to the new alarm time. Continuing the exampleabove, if the calendar event data indicates that the user has scheduleda meeting at 8:30 am and the amount of time the user needs to performthe user's morning ritual is 1 hour, then sleep logic 102 will notchange the alarm time to 7:45 am because changing the alarm tune wouldcause the user to miss the 8:30 meeting (e.g., the users morning ritualwould. last until 8:45 am). However, if the calendar event dataindicates that the user has a meeting scheduled for 9:00 am, sleep logic1.02 can change the alarm time to 7:45 because the user will still beable to perform the user's morning ritual and attend the scheduledmeeting (e.g., the user has enough time to get ready for the meeting).

In some implementations, sleep logic 102 can determine whether to adjustthe alarm clock settings based on the morning ritual duration and theamount of time needed to travel to a scheduled meeting. Continuing theexample above, if the calendar event data indicates that the user hasscheduled a meeting at 8:30 am and the amount of time the user needs toperform the user's morning ritual (e.g. 0.5 hour) and travel (e.g., 1hour) to the meeting location is 1.5 hours, then sleep logic 102 willnot change the alarm time to 7:45 am because changing the alarm timewould cause the user to miss the 8:30 meeting (e.g., the users would notarrive at the meeting until 9:15 am). However, if the calendar eventdata indicates that the user has a meeting scheduled for 9:30 am, sleeplogic 102 can change the alarm time to 7:45 because the user will stillbe able to perform the user's morning ritual and travel to the scheduledmeeting location in time to attend the scheduled meeting.

In some implementations, sleep logic 102 can determine whether to adjustthe alarm clock settings based on a user's sleep goal. For example, theuser of computing device 100 can specify a number of hours that the userwould like to sleep each night. Sleep logic 102 can adjust the alarmclock settings based on the sleep goal in the same way as sleep logic102 adjusts the alarm clock settings based on the sleep onset latencyduration, as described above. For example, sleep logic 102 can determinewhen the user falls asleep. Sleep logic 102 can determine when the usershould wake up based when the user fall asleep and the sleep goal. Sleeplogic 102 can determine whether to adjust a scheduled alarm time toallow the user to sleep the number of hours specified by the user'ssleep goal by determining whether the a new sleep time generated basedon the user's sleep goal will cause the user to miss a scheduledmeeting, a described above. Sleep logic 102 can determine whether thescheduled alarm time can be adjusted to accommodate the user's sleepgoal based on travel time and/or the duration of the user's morningritual to, for example.

In some implementations, sleep logic 102 can suggest an adjustment tothe user's sleep routine when a scheduled alarm time should not beadjusted based on the user's sleep onset latency. For example, whensleep logic 102 determines that the user has a sleep onset latencyduration of 30 minutes and determines that the scheduled alarm timecannot be adjusted, as described above, sleep logic 102 can causenotification process 144 to present a message on the display ofcomputing device 100 that suggests an earlier bedtime to the user. Forexample, sleep logic 102 can send the message to notification process144 and notification process 144 can present the message in anotification on the display of computing device 100. Notificationprocess 144 can be a standalone application or a process or function ofthe operating system of computing device 100, for example.

FIG. 2 illustrates an example graphical user interface 200 forspecifying a sleep goal. For example, graphical user interface (GUI) 200can be a GUI of alarm clock application 142. GUI 200 can be presented ona display of computing device 100. GUI 200 can present graphicalelements 202 that a user can select or manipulate to specify a time(e.g., 7:00 am) at which an alarm should be presented by alarm clockapplication 142 on computing device 100. For example, the alarm can bepresented as a sound, a vibration, and/or a graphical notificationpresented by computing device 100. GUI 200 can present graphical element204 that a user can select to turn on or off the automatic alarmadjustment features described above. For example, the user can selectgraphical element 204 to enable or disable automatic adjustment of thealarm time specified using graphical elements 202 based on the user'ssleep onset latency duration and/or sleep goal. GUI 200 can presentgraphical element 206 that allows a user to specify an amount of timefor the user's sleep goal. For example, the user can type a number intographical element 206 to specify the user's sleep goal.

FIG. 3 illustrates an example graphical user interface 300 of a calendarapplication. For example GUI 300 can be a graphical user interface ofcalendar application 140. GUI 300 can be presented on a display ofcomputing device 100. GUI 300 can represent calendar events (e.g.,meetings) that are scheduled in calendar application 140. For example,GUI 300 can present information related to meeting 302 scheduled at 8:00am. In some implementations, sleep logic 102 can determine whether toadjust alarm time specified using graphical element 202 of FIG. 2 forthe user's sleep onset latency based on whether the adjusted alarm timewould cause the user to miss meeting 302 scheduled in calendarapplication 140. Sleep logic 102 can determine whether the user wouldmiss meeting 302 based on the sleep onset latency adjustment, traveltime, and/or the duration of the user's morning ritual, as describedabove.

FIG. 4 illustrates an example graphical user interface 400 fordetermining a sleep onset latency duration based on pressure applied bya user to a display of a computing device. For example, GUI 400 can be agraphical user interface of sleep application 146 of FIG. 1. GUI 400 canbe presented on a display (e.g., touch sensitive display) of computingdevice 100. GUI 400 can present a user interface for a nap function ofsleep application 146, for example. In some implementations, GUI 400 canpresent graphical element 402. Graphical element 402 (e.g., a nap typeselector) can be manipulated (e.g., selected, slid, etc.) by the user toselect a type of nap.

In some implementations, the user can select a timed nap function bymanipulating graphical element 402. For example, the timed nap functioncan wake the user with an alarm after a specified period of time. Whenthe timed nap function is selected by the user, the user can enter anamount of time in graphical element 404 (e.g., a text box) to specify anamount of time to nap (e.g., nap window). When the user is ready to nap,the user can press and hold an area of the display of computing device100 (as indicated by graphical element 408) to begin a nap timer thatwill sound an alarm after the specified amount of time has elapsed. Forexample, graphical element 408 can include a prompt requesting that theuser apply pressure to an area of the display of computing device 100.When the user is ready to begin sleeping (napping), the user can pressand continue to apply pressure to the display. As described above, thedisplay of computing device 100 can include or be backed by a pressuresensor for detecting the amount of pressure applied by a user to thedisplay. When the user initially applies pressure to the display, thenapping function can begin the nap timer. When the timer runs down tozero, the napping function can wake the user with an (e.g., audible)alarm.

In some implementations, the timed nap function can determine anddisplay the actual sleep duration. For example, sleep logic 102 candetermine the sleep onset latency for the nap period based on thepressure applied to the display of computing device 100, as describedabove. For example, when the user initially applies pressure to thedisplay, sleep logic 102 can determine that the sleep onset latencyperiod has begun (e.g., the user intends to sleep). When the userreleases pressure from the display sleep logic 02 can determine that thesleep onset latency period has ended (e.g., the user has fallen asleepand cannot maintain the pressure on the display). When the alarm soundsafter the specified nap period has elapsed, sleep logic 102 candetermine that the user is awake. Thus, sleep logic 102 can use the timeat which the user initially applied pressure, the time at which the userreleased pressure, and the time at which the user woke to determine thesleep onset latency duration (e.g., time when pressure released−timewhen pressure applied) and actual sleep duration (e.g., time when alarmsounded−time when pressure released). When the alarm goes off, sleepapplication 146 can obtain the sleep onset latency duration and actualsleep duration from sleep logic 102 and present the durations to theuser on a GUI 400.

In some implementations, the user can select a timed sleep function bymanipulating graphical element 402. For example, when timed sleep isselected, the napping function can automatically adjusting the nap alarmbased on sleep onset latency. When the user selects the timed sleepfunction, the napping function can automatically adjust the nap alarmbased on sleep onset latency. For example, when the timed sleep functionis selected, the user can specify the amount of time the user wishes tosleep using graphical element 404. For example, sleep logic 102 candetermine when the user begins sleeping based on when the user releasespressure from the display of computing device 100, as described above.In response to determining that the user is asleep, sleep application146 can start a sleep timer that counts down an amount of timecorresponding to the amount of sleep specified by the user. For example,if the user specified 15 minutes of sleep, sleep application 146 canstart a 15 minute timer when sleep logic 102 detects that the user isasleep. Thus, the user will get the full 15 minutes of sleep that theuser desired.

In some implementations, the user can select a power nap function thatwakes the user with an alarm when sleep logic 102 determines that theuser is entering a deep sleep. For example, the user can manipulate(e.g., select) graphical element 402 to select the power nap function ofsleep application 146. When the power nap function is selected, sleepapplication 146 can request that sleep logic 102 notify sleepapplication 146 when the user enters a deep sleep. For example,computing device 100 (e.g., a wearable device such as a watch) candetect when the user falls into (or is about to fall into) a deep sleepstate. For example, sensors built into computing device 100 can detectthe rate and variability of heartbeats and breathing, as describedabove. Sleep logic 102 can determine that the user has fallen asleepwhen the heart rate and/or breathing rate fall below a sleep startthreshold rate for heart rate or breathing rate. When the user fallsinto a deep sleep, the user's heartrate and breathing will be reducedeven more than initial sleep. Sleep logic 102 can determine that theuser has fallen asleep when the heart rate and/or breathing rate fallbelow a deep sleep threshold rate for heart rate or breathing rate thatis lower than the sleep start threshold rate. When sleep logic 102determines that the user's heart rate and/or breathing rate is near orbelow the deep sleep threshold rate, sleep logic 102 can notify sleepapplication 146 and sleep application 146 can sound the alarm to wakethe user. Thus, the user will realize the benefit of sleep without thegrogginess that is experienced when a user is awakened from a deepsleep.

FIG. 5 illustrates an example graphical user interface 500 forsuggesting an earlier bedtime to the user. For example, GUI 500 can be agraphical user interface of computing device 100. In someimplementations, GUI 500 can present notification 502 suggesting anearlier bedtime to the user. For example, when sleep logic 102determines that an alarm should not be adjusted based on the user'ssleep onset latency duration because of a conflicting calendarappointment, sleep logic 102 can cause a notification to be presentedthat suggests an earlier bedtime the following night. Sleep logic 102can determine the earlier bedtime based on the sleep onset latencyduration and/or the user's sleep goal. For example, if the usertypically goes to bed at 10 pm and. the sleep onset latency from theprevious night was 30 minutes, sleep logic 102 can suggest a bedtime 30minutes earlier than 10 pm. (e.g., 9:30 pm). If the user typically goesto bed at 10 pm and the sleep deficit (e.g., sleep goal minus actualsleep) from the previous night was 30 minutes, sleep logic 102 cansuggest a bedtime 30 minutes earlier than 10 pm (e.g., 9:30 pm).

In some implementations. GUI 500 can include graphical element 504 forconfiguring a sleep reminder on computing device 100. For example, theuser can select graphical element 504 to set sleep reminder for thebedtime (e.g., 9:30 pm) suggested by sleep logic 102. When the userselects graphical element 504 a sleep reminder can be scheduled for thesuggested time. When computing device 100 (e.g., sleep logic 102, areminder application, etc.) determines that the current time is thesuggested sleep time, a notification or alarm can be presented bycomputing device 100 reminding the user to go to bed.

FIG. 6 illustrates an example graphical user interface 600 forpresenting a sleep summary indicating a pattern of long sleep onsetlatency durations. In some implementations, sleep logic 102 can analyzesleep history data to identify patterns of long sleep onset latencyduration. For example, sleep onset latency durations can be categorizedas short, normal, and long. A normal sleep onset latency duration can bea duration between a low duration value and a high duration value. Ashort sleep onset latency duration can he a sleep onset latency durationbelow the low value (e.g. 5 minutes). A long sleep onset latencyduration can be a sleep onset latency duration above the high value(e.g., 25 minutes). In some implementations sleep logic 102 can adjustalarms based on the determined sleep onset latency. However, in someimplementations, when the user is experiencing recurring long or shortsleep onset latency patterns, sleep logic 102 may not adjust alarms oncomputing device 100. In some implementations, when the user isexperiencing recurring long or short sleep onset latency patterns, sleeplogic 102 can present a sleep summary to draw the user's attention tothe sleep onset latency patterns.

In some implementations, sleep logic 102 can present notification 602 onGUI 600 when sleep logic detects a pattern of long sleep onset latency.A pattern of long sleep onset latency may indicate that the user ishaving difficulty falling asleep. For example, when sleep logic 102identifies a pattern (e.g., over a number of days) of long sleep onsetlatency durations, sleep logic 102 can present a summary of the user'ssleep history using notification 602. Notification 602 can present datarepresenting the sleep onset latency durations and actual sleepdurations over the previous number of days, for example.

In some implementations, notification 602 can include a suggestion 604for activities that the user might perform to improve the user's sleep.For example, suggestion 604 can suggest that the user write her thoughtsin a journal, adopt a more consistent routine, go to bed earlier or whenfeeling fatigued, or speak to a physician about her difficulty fallingasleep.

FIG. 7 illustrates an example graphical user interface 700 forpresenting a sleep summary indicating a pattern of short sleep onsetlatency durations. A pattern of short sleep onset latency durations canindicate that the user is not getting enough sleep. In someimplementations, sleep logic 102 can present notification 702 on GUI 600when sleep logic detects a pattern of short sleep onset latency. Forexample, when sleep logic 102 identifies a pattern (e.g., over a numberof days) of short sleep onset latency durations, sleep logic 102 canpresent a summary of the user's sleep history using notification 702.Notification 702 can present data representing the sleep onset latencydurations and actual sleep durations over the previous number of days,for example.

In some implementations, notification 702 can include a suggestion 704for activities that the user might perform to improve the user's sleep.For example, suggestion 704 can suggest that the user go to bed earlier,sleep later, lengthen her sleep period, or speak to a physician abouther difficulty getting enough asleep.

Example Processes

FIG. 8 is flow diagram of an example process 800 for determining sleeponset latency. For example, sleep onset latency is a period of timeduring which the user is trying to go to sleep but has not achieved asleep state. The beginning of sleep onset latency can correspond to atime when the user intends to sleep. The end of sleep onset latency cancorrespond to a time when the user falls asleep.

At step 802, computing device 100 can detect a sleep ritual activity.For example, the user may have a ritual of activities that they performbefore going to sleep. The user may brush her teeth, run the dishwasher,take a shower, exercise, turn off the bedroom light, lock a door, etc.Computing device 100 can detect these sleep ritual activities accordingto mechanisms described herein above.

At step 804 computing device 100 can determine that the user intends tosleep. For example, computing device 100 can determine that the userintends to sleep when the user finishes performing the user's sleepritual, as described above. Computing device 100 can determine that theuser intends to sleep based on user input. Computing device 100 candetermine that the user intends to sleep based on sensor data (e.g.,biometric data) collected by computing device 100, as described above.

At step 806 computing device 100 can determine a start time for theuser's sleep onset latency period. For example, the start time cancorrespond to the time when computing device determines that the userintends to sleep. The start time can correspond to when the lastactivity of the user's sleep ritual was performed. The start time cancorrespond to when the last user input was received. The start time cancorrespond to a time when sensors detected conditions indicative of theuser's intent to sleep.

At step 808, computing device 100 can detect sleep signals. For example,sleep signals can include sounds (e.g., snoring, lack of bed noises thatreflect the user moving in the bed), biometric data (e.g., heart rate,breathing rate, etc.), and/or lack of user input (e.g., releasingpressure from a pressure sensitive display).

At step 810, computing device 100 can determine an end time for sleeponset latency and/or a start time for sleep. For example, the sleeponset latency period can end when the user falls asleep. The time atwhich the sleep onset latency period ends and the sleep period beginscan correspond to a time when computing device 100 first detected thesleep signals at step 808. Computing device 100 can determine that theuser is asleep when computing device 100 detects the sleep signals for aperiod of time (e.g., 10 minutes).

At step 812, computing device 100 can detect wake signals. For example,wake signals can include user input to computing device 100, movement ofcomputing device 100, sounds corresponding to conscious human activity,and/or other signals indicating that the user is awake.

At step 814, computing device 100 can determine an end time for sleep.For example, the end time for sleep can correspond to a time whencomputing device 100 first detected the wake signals at step 812. Theend time for sleep can correspond to the beginning of a period ofconscious user activity. For example, if computing device 100 detectswake signals for a period of time greater than a threshold period oftime (e.g., greater than 5 minutes, greater than 10 minutes, etc.), thencomputing device. 100 can determine that the user's sleep period hasconcluded. By detecting that the user is awake for longer than thethreshold period of time, computing device 100 can avoid an erroneouswake determination when the user briefly wakes in the middle of thenight to use the restroom or perform some other midnight activity.

At step 816, computing device 100 can calculate a sleep onset latencyduration and/or a sleep duration. For example, the sleep onset latencyduration can be calculated as the time difference between the start timefor sleep onset latency and the end time (e.g., start of sleep) forsleep onset latency. The sleep duration can be calculated as the timedifference between the start time for sleep and the end time (e.g.,start of sleep) for sleep. In some implementations, the sleep durationcan be adjusted based on brief nocturnal wake periods, as describedabove. Once the sleep onset latency duration and/or the sleep durationare calculated, computing device 100 can store the sleep onset latencyduration and/or sleep duration as historical sleep data.

FIG. 9 is a flow diagram of an example process 900 for adjusting alarmsbased on sleep onset latency. For example, computing device 100 canadjust an alarm set to wake the user in the morning based on adetermined sleep onset latency duration in order to allow the user toget a sufficient amount of sleep.

At step 902, computing device 1.00 can obtain a sleep onset latencyduration. For example, computing device 100 can monitor the user'sactivities as the user is preparing to sleep and while going to sleep.Computing device 100 can calculate the user's sleep onset latencyduration for the current instance of sleep based on the user'sactivities and other sensor data, as described above.

At step 904, computing device 100 can obtain alarm data. For example,computing device 100 can obtain alarm data from an alarm clockapplication. Computing device 100 can determine whether an alarm is setto wake the user up in the morning and determine a time at which thealarm is scheduled to wake the user.

At step 906, computing device 100 can obtain calendar data. For example,computing device 100 can obtain calendar data from a calendarapplication. Computing device 100 can determine whether a calendar eventis scheduled in the morning and near the time of the scheduled alarm.When a scheduled calendar event exists, computing device 100 candetermine a start time associated with the scheduled calendar event.

At step 908, computing device 100 can determine whether to adjust thescheduled alarm time based on the obtained sleep onset latency and thecalendar data. For example, computing device 100 can determine whetheradjusting the alarm time to add the sleep onset latency duration to theuser's sleep period would cause the user to miss the scheduled calendarevent, as described above.

At step 910, computing device 100 can adjust the scheduled alarm timebased on the sleep onset latency duration when the scheduled calendarevent allows for a later wake time. For example, if the user will stillbe able to attend the scheduled calendar event after the scheduled alarmtime is adjusted, then computing device 100 can adjust the scheduledalarm time based on the sleep onset latency duration to give the usermore time to sleep. For example, computing device 100 can add the sleeponset latency duration to the scheduled alarm time to calculate a newalarm time. Computing device 100 can adjust the scheduled alarm time tocorrespond to the new alarm time. Thus, computing device 100 can helpthe user get a sufficient amount of sleep and feel well rested.

At step 912, computing device 100 can suggest an earlier sleep timebased on the sleep onset latency duration when the calendar data doesnot allow a later wake time. For example, if adjusting the scheduledalarm time would cause the user to miss the calendar event, computingdevice 100 can present a notification suggesting that the user go to bedearlier the following night. Thus, computing device 100 can help theuser get a sufficient amount of sleep and feel well rested.

FIG. 10 is a flow diagram of an example process 10000 for identifying apattern of abnormal sleep onset latency. For example, sleep onsetlatency durations can be indicative of a problem sleeping. A recurringpattern of short sleep onset latency can indicate sleep deprivation orexhaustion. A recurring pattern of long sleep onset latency can indicatea mental or physical problem. By presenting information describing auser's sleep onset latency patterns, computing device 100 can draw auser's attention to sleep problems and prompt the user to get helpresolving their sleep issues.

At step 1002, computing device 100 can obtain a sleep onset latencyduration. For example, computing device 100 can monitor the user'sactivities as the user is preparing to sleep and while going to sleep.Computing device 100 can calculate the user's sleep onset latencyduration for the current instance of sleep based on the user'sactivities and other sensor data.

At step 1004, computing device 100 can identify a historical pattern oflong and/or short sleep onset latency. For example, in response toobtaining the sleep onset latency duration at step 1002, computingdevice 100 can determine whether the current instance of sleep onsetlatency is of a short or long duration (e.g., not normal). If thecurrent sleep onset latency duration is short, computing device 100 cananalyze the historical sleep data to determine if the user isexperiencing a pattern of short sleep onset latency durations. Forexample, if four out of the last five days of historical sleep dataindicate a short sleep onset latency duration, then computing device 100can determine that the user has a recurring pattern of short sleep onsetlatency durations. Similarly, if the current sleep onset latencyduration is long, computing device 100 can analyze the historical sleepdata to determine if the user is experiencing a pattern of long sleeponset latency durations. For example, if three out of the last five daysof historical sleep data indicate a long sleep onset latency duration,then computing device 100 can determine that the user has a recurringpattern of long sleep onset latency durations.

At step 1006, computing device 100 can present a summary of sleep data.For example, when computing device 100 identifies a history of long orshort sleep onset latency durations, computing device 100 can present asleep history summary that identifies the sleep onset latency durationsand/or the sleep durations for a period of time over which the patternof short or long sleep onset latency durations occurred.

At step 1008, computing device 100 can suggest adjustments to the user'ssleep routine. For example, when computing device 100 identifies apattern of short sleep onset latency, computing device 100 can suggestthat the user get more sleep or adjust the user's sleep goal. Whencomputing device 100 identifies a pattern of long sleep onset latency,computing device 100 can suggest that the user write her thoughts into ajournal, adopt a more consistent day to day routine, or speak to aphysician. Thus, computing device 100 can draw the user's attention topotential sleep issues in an attempt to help the user sleep better.

Example System Architecture

FIG. 11 is a block diagram of an example computing device 1100 that canimplement the features and processes of FIGS. 1-10. The computing device1100 can include a memory interface 1102, one or more data processors,image processors and/or central processing units 1104, and a peripheralsinterface 1106. The memory interface 1102, the one or more processors1104 and/or the peripherals interface 1106 can be separate components orcan be integrated in one or more integrated circuits. The variouscomponents in the computing device 1100 can be coupled by one or morecommunication buses or signal lines.

Sensors, devices, and subsystems can be coupled to the peripheralsinterface 1106 to facilitate multiple functionalities. For example, amotion sensor 1110, a light sensor 1112, and a proximity sensor 1114 canbe coupled to the peripherals interface 1106 to facilitate orientation,lighting, and proximity functions. Other sensors 1116 can also beconnected to the peripherals interface 1106, such as a global navigationsatellite system (GNSS) (e.g., GPS receiver), a temperature sensor, abiometric sensor, magnetometer or other sensing device, to facilitaterelated functionalities.

A camera subsystem 1120 and an optical sensor 1122, e.g., a chargedcoupled device (CCD) or a complementary metal-oxide semiconductor (CMOS)optical sensor, can be utilized to facilitate camera functions, such asrecording photographs and video clips. The camera subsystem 1120 and theoptical sensor 1122 can be used to collect images of a user to be usedduring authentication of a user, e.g., by performing facial recognitionanalysis.

Communication functions can be facilitated through one or more wirelesscommunication subsystems 1124, which can include radio frequencyreceivers and. transmitters and/or optical (e.g., infrared) receiversand transmitters. The specific design and implementation of thecommunication subsystem 1124 can depend on the communication network(s)over which the computing device 1100 is intended to operate. Forexample, the computing device 1100 can include communication subsystems1124 designed to operate over a GSM network, a GPRS network, an EDGEnetwork, a Wi-Fi or WiMax network, and a Bluetooth™ network. Inparticular, the wireless communication subsystems 1124 can includehosting protocols such that the device 100 can be configured as a basestation for other wireless devices.

An audio subsystem 1.126 can be coupled to a speaker 1128 and amicrophone 1130 to facilitate voice-enabled functions, such as speakerrecognition, voice replication, digital recording, and telephonyfunctions. The audio subsystem 1126 can be configured to facilitateprocessing voice commands, voiceprinting and voice authentication, forexample.

The I/O subsystem 1140 can include a touch-surface controller 1142and/or other input controller(s) 1144. The touch-surface controller 1142can be coupled to a touch surface 1146. The touch surface 1146 andtouch-surface controller 1142 can, for example, detect contact andmovement or break thereof using any of a plurality of touch sensitivitytechnologies, including but not limited to capacitive, resistive,infrared, and surface acoustic wave technologies, as well as otherproximity sensor arrays or other elements for determining one or morepoints of contact with the touch surface 1146.

The other input controller(s) 1144 can be coupled to other input/controldevices 1148, such as one or more buttons, rocker switches, thumb-wheel,infrared port, USB port, and/or a pointer device such as a stylus. Theone or mare buttons (not shown) can include an up/down button for volumecontrol of the speaker 1128 and/or the microphone 1130.

In one implementation, a pressing of the button. for a first durationcan disengage a lock of the touch surface 1146; and a pressing of thebutton for a second duration that is longer than the first duration canturn power to the computing device 1100 on or off. Pressing the buttonfor a third duration can activate a voice control, or voice command,module that enables the user to speak commands into the microphone 1130to cause the device to execute the spoken command. The user cancustomize a functionality of one or more of the buttons. The touchsurface 1146 can, for example, also be used to implement virtual or softbuttons and/or a keyboard.

In some implementations, the computing device 1100 can present recordedaudio and/or video files, such as MP3, AAC, and MPEG files. In someimplementations, the computing device 1100 can include the functionalityof an MP3 player, such as an iPod™. The computing device 1100 can,therefore, include a 36-pin connector that is compatible with the iPod.Other input/output and control devices can also be used.

The memory interface 1102 can be coupled to memory 1150. The memory 1150can include high-speed random access memory and/or non-volatile memory,such as one or more magnetic disk storage devices, one or more opticalstorage devices, and/or flash memory (e.g., NAND, NOR). The memory 1150can store an operating system 1152, such as Darwin, RTXC, LINUX, UNIX,OS X, WINDOWS, or an embedded operating system such as VxWorks.

The operating system 1152 can include instructions for handling basicsystem services and for performing hardware dependent tasks. In someimplementations, the operating system 1152 can be a kernel (e.g., UNIXkernel). For example, operating system 1152 can implement the sleeponset latency and/or sleep detection features as described withreference to FIGS. 1-10.

The memory 1150 can also store communication instructions 1154 tofacilitate communicating with one or more additional devices, one ormore computers and/or one or more servers. The memory 1150 can includegraphical user interface instructions 1156 to facilitate graphic userinterface processing; sensor processing instructions 1158 to facilitatesensor-related processing and functions; phone instructions 1160 tofacilitate phone-related processes and functions; electronic messaginginstructions 1162 to facilitate electronic-messaging related processesand functions; web browsing instructions 1164 to facilitate webbrowsing-related processes and functions; media processing instructions1166 to facilitate media processing-related processes and functions;GNSS/Navigation instructions 1168 to facilitate GNSS andnavigation-related processes and instructions; and/or camerainstructions 1170 to facilitate camera-related processes and. functions.

The memory 1150 can store other software instructions 1172 to facilitateother processes and functions, such as the sleep onset latency and/orsleep detection processes and functions as described with reference toFIGS. 1-10.

The memory 1150 can also store other software instructions 1174, such asweb video instructions to facilitate web video-related processes andfunctions; and/or web shopping instructions to facilitate webshopping-related processes and functions. In some implementations, themedia processing instructions 1166 are divided into audio processinginstructions and video processing instructions to facilitate audioprocessing-related processes and functions and video processing-relatedprocesses and functions, respectively.

Each of the above identified instructions and applications cancorrespond to a set of instructions for performing one or more functionsdescribed above. These instructions need not be implemented as separatesoftware programs, procedures, or modules. The memory 1150 can includeadditional instructions or fewer instructions. Furthermore, variousfunctions of the computing device 1100 can be implemented in. hardwareand/or in software including in one or more signal processing and/orapplication specific integrated circuits.

What is claimed is:
 1. A method comprising: detecting, by a computingdevice, performance of sleep ritual activities associated with a user ofthe computing device, wherein the user's sleep ritual includes one ormore activities that the user performs before going to bed; determining,by the computing device, a first time based on that the user hasperformed the user's sleep ritual, wherein the first time is when theuser intends to sleep; detecting, by the computing device, biologicalsignals corresponding to the user sleeping at a second time;calculating, by the computing device, a sleep onset latency durationbased on the first time and the second time; determining, by thecomputing device, a historical sleep onset latency pattern based on thesleep onset latency; calculating, by the computing device, an actualsleep duration based on the sleep onset latency duration; generating, bythe computing device, an adjustment suggestion when the sleep onsetlatency is of a short or long duration based on the actual sleepduration and the historical sleep onset latency pattern; and presentingthe adjustment suggestion on a display of the computing device.
 2. Themethod of claim 1, wherein the actual sleep duration is calculated fromthe user actually sleeping at the second time to a sleep end time,wherein the sleep end time is determined based on a scheduled alarmtime.
 3. The method of claim 1, wherein the presenting includespresenting notification.
 4. The method of claim 1, wherein the sleepritual activities include two or more activities that the user regularlyperforms before going to sleep.
 5. The method of claim 1, wherein thesleep ritual activities are detected using two or more distinct sensorsof the computing device.
 6. The method of claim 1, wherein the firsttime corresponds to a third time when the sleep ritual activities end.7. The method of claim 1, wherein the sleep onset latency duration iscalculated by determining a period of time between the first time andthe second time.
 8. A non-transitory computer-readable medium includingone or more sequences of instructions that, when executed by one or moreprocessors, causes: detecting, by a computing device, performance ofsleep ritual activities associated with a user of the computing device,wherein the user's sleep ritual includes one or more activities that theuser performs before going to bed; determining, by the computing device,a first time based on that the user has performed the user's sleepritual, wherein the first time is when the user intends to sleep;detecting, by the computing device, biological signals corresponding tothe user sleeping at a second time; calculating, by the computingdevice, a sleep onset latency duration based on the first time and thesecond time; determining, by the computing device, a historical sleeponset latency pattern based on the sleep onset latency; calculating, bythe computing device, an actual sleep duration based on the sleep onsetlatency duration; generating, by the computing device, an adjustmentsuggestion when the sleep onset latency is of a short or long durationbased on the actual sleep duration and the historical sleep onsetlatency pattern; and presenting the adjustment suggestion on a displayof the computing device.
 9. The non-transitory computer-readable mediumof claim 8, wherein the actual sleep duration is calculated from theuser actually sleeping at the second time to a sleep end time, whereinthe sleep end time is determined based on a scheduled alarm time. 10.The non-transitory computer-readable medium of claim 8, wherein thepresenting includes presenting notification.
 11. The non-transitorycomputer-readable medium of claim 8, wherein the sleep ritual activitiesinclude two or more activities that the user regularly performs beforegoing to sleep.
 12. The non-transitory computer-readable medium of claim8, wherein the sleep ritual activities are detected using two or moredistinct sensors of the computing device.
 13. The non-transitorycomputer-readable medium of claim 8, wherein the first time correspondsto a third time when the sleep ritual activities end.
 14. Thenon-transitory computer-readable medium of claim 8, wherein the sleeponset latency duration is calculated by determining a period of timebetween the first time and the second time.
 15. A system comprising: oneor more processors; and a non-transitory computer-readable mediumincluding one or more sequences of instructions that, when executed bythe one or more processors, causes: detecting, by a computing device,performance of sleep ritual activities associated with a user of thecomputing device, wherein the user's sleep ritual includes one or moreactivities that the user performs before going to bed; determining, bythe computing device, a first time based on that the user has performedthe user's sleep ritual, wherein the first time is when the user intendsto sleep; detecting, by the computing device, biological signalscorresponding to the user sleeping at a second time; calculating, by thecomputing device, a sleep onset latency duration based on the first timeand the second time; determining, by the computing device, a historicalsleep onset latency pattern based on the sleep onset latency;calculating, by the computing device, an actual sleep duration based onthe sleep onset latency duration; generating, by the computing device,an adjustment suggestion when the sleep onset latency is of a short orlong duration based on the actual sleep duration and the historicalsleep onset latency pattern; and presenting the adjustment suggestion ona display of the computing device.
 16. The system of claim 15, whereinthe actual sleep duration is calculated from the user actually sleepingat the second time to a sleep end time, wherein the sleep end time isdetermined based on a scheduled alarm time.
 17. The system of claim 15,wherein the presenting includes presenting notification.
 18. The systemof claim 15, wherein the sleep ritual activities include two or moreactivities that the user regularly performs before going to sleep. 19.The system of claim 15, wherein the sleep ritual activities are detectedusing two or more distinct sensors of the computing device.
 20. Thesystem of claim 15, wherein the first time corresponds to a third timewhen the sleep ritual activities end.
 21. The system of claim 15,wherein the sleep onset latency duration is calculated by determining aperiod of time between the first time and the second time.